﻿<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Master_Page/Master_IPORT.Master" CodeBehind="Facility.aspx.vb" Inherits="I_PORT.Facility" 
    title="IRPC INTELLIGENT PORT SERVICE" %>
    
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Src="~/Control/Confirm.ascx" TagName="Confirm1" TagPrefix="Confirm" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript" language="javascript">
                    var _source;
    // keep track of the popup div
    var _popup;

    function showConfirm(customerid) {
        this._source = customerid;
        this._popup = $find('ModalPopupExtender3'); 
        this._popup.show();  
    }
       function okClick(){
        //  find the confirm ModalPopup and hide it
       this._popup.hide();

        __doPostBack(this._source.name,'');
        
    }
    
    function cancelClick(){
        //  find the confirm ModalPopup and hide it
        this._popup.hide();
    }
        function closeModal() {
           document.getElementById('ctl00_contentplaceholder1_framePopup').src = '../MasterPopup/Facility_Popup.aspx';
            var mpu = $find('ctl00_ContentPlaceHolder1_ModalPopupExtender1');
            mpu.hide();
            document.getElementById('ctl00_contentplaceholder1_btnLoad').click();
        }
        function showPopup() {
             document.getElementById('ctl00_contentplaceholder1_framePopup').contentWindow.location.reload(true);
        }
</script>
<asp:UpdatePanel ID="Update1" runat="server">
  <ContentTemplate>
     <table width="100%" border="0" cellpadding="2" cellspacing="0">
        <tr>
             <td style="width:20%;" align="right"><asp:Label ID="lbNameCustomer" runat="server" SkinID="lbtxt" Text="Mla_Host :"></asp:Label>&nbsp;</td>
             <td align="left"><asp:TextBox ID="txtMla" runat="server"></asp:TextBox>
             </td>
        </tr>
        <tr>
             <td style="width:20%;" align="right"><asp:Label ID="Label1" runat="server" SkinID="lbtxt" Text="Diameter :"></asp:Label>&nbsp;</td>
             <td align="left"><asp:TextBox ID="txtDiameter" runat="server"></asp:TextBox>
             <asp:Button ID="btnSearch" runat="server" Text="ค้นหา" CssClass="ButtonStyle" />
             </td>
        </tr>
        <tr>
           <td style="height:5px;"><img src="../Image/space.gif" /></td>
        </tr>
        <tr>
           <td align="center" colspan="2">
              <asp:UpdatePanel ID="updatePanelGrid" runat="server" UpdateMode="Conditional"><ContentTemplate>
              <asp:GridView ID="gridFacility" runat="server" SkinID="gridblue"  DataKeyNames="Facility_Code,Mla_Host,Diameter"
                     AutoGenerateColumns="False">
                     <PagerTemplate>
                                            <table>
                                                <tr>
                                                    <td>
                                                        <asp:ImageButton ID="ImgFirst" runat="server" Height="22px" ImageUrl="../Image/arrow-first.gif"
                                                            OnCommand="Paginate" CommandArgument="First" CommandName="Page" />
                                                    </td>
                                                    <td>
                                                        <asp:ImageButton ID="ImgBack" runat="server" Height="22px" ImageUrl="../Image/arrow-back.gif"
                                                            OnCommand="Paginate" CommandArgument="Prev" CommandName="Page" />
                                                    </td>
                                                    <td valign="top">
                                                        Page
                                                        <asp:DropDownList ID="ddlPage" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlPage_SelectedIndexChanged">
                                                        </asp:DropDownList>
                                                        of
                                                        <asp:Label ID="lbPageCount" runat="server" Text="Label"></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:ImageButton ID="ImgNext" runat="server" Height="22px" ImageUrl="../Image/arrow-next.gif"
                                                            OnCommand="Paginate" CommandArgument="Next" CommandName="Page" />
                                                    </td>
                                                    <td>
                                                        <asp:ImageButton ID="ImgEnd" runat="server" Height="22px" ImageUrl="../Image/arrow-end.gif"
                                                            OnCommand="Paginate" CommandArgument="Last" CommandName="Page" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </PagerTemplate>
                     <Columns> 
                         <asp:BoundField HeaderText="Mla/Host" DataField="Mla_Host" />
                         <asp:BoundField HeaderText="Diameter(inch)" DataField="Diameter" />
                         <asp:TemplateField HeaderText="แก้ไข" ItemStyle-Width="50px">
                             <ItemTemplate>
                                 <asp:ImageButton ID="imgedit" CommandName="cmdedit" CommandArgument="<%# Container.DataItemIndex %>"  runat="server" ImageUrl="~/Image/edit-24.gif" />
                             </ItemTemplate>
                         </asp:TemplateField>
                        <asp:TemplateField HeaderText="ลบ" ItemStyle-Width="50px">
                            <ItemTemplate>
                                 <asp:ImageButton ID="imgdelete" CommandName="cmddelete" CommandArgument="<%# Container.DataItemIndex %>" OnClientClick="showConfirm(this); return false;"  runat="server" ImageUrl="~/Image/cancel-24.gif" />
                             </ItemTemplate>
                         </asp:TemplateField>
                     </Columns>
                 </asp:GridView>
               </ContentTemplate></asp:UpdatePanel>
           </td>
        </tr>
        <tr>
           <td style="height:5px;"><img src="../Image/space.gif" /></td>
        </tr>
        <tr>
           <td style="width:20%;" align="right"></td>
           <td align="left"><asp:Button ID="btnNewFacility" runat="server" Text="New Facility"  OnClientClick="showPopup();" CssClass="ButtonStyle" /></td>
        </tr>
     </table>
     <asp:Button ID="btnAdd" runat="server" Text="" style="display:none" />
      <asp:Button ID="btnLoad" runat="server" Text="ปิด" style="display:none;" />
     <asp:Button ID="BtnTrigger" runat="server" style="display:none;" />
    <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BackgroundCssClass="Background"
     TargetControlID="btnAdd" PopupControlID="PopupAdd" >
    </asp:ModalPopupExtender>
            <asp:ModalPopupExtender ID="ModalPopupExtender3" BehaviorID="ModalPopupExtender3" runat="server" 
                                    OkControlID="ctl00_contentplaceholder1_ConfirmDelete_btnOk" 
                                    OnOkScript="okClick();" 
                                    CancelControlID="ctl00_contentplaceholder1_ConfirmDelete_btnNo"     
                                    OnCancelScript="cancelClick();" 
                                     BackgroundCssClass="Background" DropShadow="false" 
                                      PopupControlID="PanelConfirm" TargetControlID="BtnTrigger" >
        </asp:ModalPopupExtender>
    <asp:Panel ID="PopupAdd" runat="server" Style="display: none;">
        <table>
            <tr>
                <td>
                    <iframe runat="server" id="framePopup" class="Style-Iframe" marginheight="0px" marginwidth="0px" src="../MasterPopup/Facility_Popup.aspx" >
                    </iframe>
                </td>
            </tr>
        </table>
    </asp:Panel>
        <asp:Panel ID="PanelConfirm" runat="server" style="display:none;">
       <Confirm:Confirm1 ID="ConfirmDelete" runat="server" ></Confirm:Confirm1>
    </asp:Panel>
  </ContentTemplate>
</asp:UpdatePanel>
<%--<script type="text/javascript"> 
tabdropdown.init("colortab", 2)
</script>--%>
</asp:Content>
